<?php
/**
 * Registering meta boxes
 *
 * All the definitions of meta boxes are listed below with comments.
 * Please read them CAREFULLY.
 *
 * You also should read the changelog to know what has been changed before updating.
 *
 * For more information, please visit:
 * @link http://www.deluxeblogtips.com/meta-box/
 */

/********************* META BOX DEFINITIONS ***********************/

/**
 * Prefix of meta keys (optional)
 * Use underscore (_) at the beginning to make keys hidden
 * Alt.: You also can make prefix empty to disable it
 */
// Better has an underscore as last sign
$prefix = '_orion2_';

global $meta_boxes;

$meta_boxes = array();

    $meta_boxes[] = array(
        'id'         => 'page_attributes',
        'title'      =>  _('Page attributes'),
        'pages'      => array( 'page', ), // Post type
        'context'    => 'normal',
        'priority'   => 'high',
        'show_names' => true, // Show field names on the left
        'fields'     => array(
            array(
                'name' =>  _('Section Type'),
                'desc' =>  _('Select a section type'),
                'id' => $prefix . 'section_type',
                'type' => 'select',
                'options' => array(
                    '0' => 'Normal',
                    '1' => 'Portfolio',
                    '2' => 'Contact'
                )
            ),
            array(
                'name' =>  _('Background color'),
                'desc' =>  _('Choose section background color. Default: #1d1c1c'),
                'id'   => $prefix . 'background',
                'type' => 'color',
                'std'  => '#1d1c1c'
            ),
            array(
                'name' =>  _('Parallax banner'),
                'desc' =>  _('Have the section a parralax footer banner?'),
                'id'   => $prefix . 'parallax',
                'type' => 'checkbox',
            ),
            array(
                'name' => _('Parallax banner image'),
                'desc' =>  _('Upload an image or enter an URL.'),
                'id'   => $prefix . 'parallax_images',
                'type' => 'plupload_image',
                'max_file_uploads' => 1
            ),
            array(
                'name' =>  _('Parallax banner title'),
                'id'   => $prefix . 'parallax_title',
                'type' => 'text',
            ),
            array(
                'name' =>  _('Parallax banner description'),
                'id'   => $prefix . 'parallax_description',
                'type' => 'text',
            )

        ),
    );

    $meta_boxes[] = array(
        'id'         => 'project_info',
        'title'      =>  _('Project information'),
        'pages'      => array( 'project', ), // Post type
        'context'    => 'normal',
        'priority'   => 'high',
        'show_names' => true, // Show field names on the left
        'fields'     => array(
            array(
                 'name' => _('Project images'),
                    'desc' =>  _('Upload multiple images'),
                    'id'   => $prefix . 'project_images',
                    'type' => 'plupload_image'
            ),
            array(
                'name' =>  _('Video'),
                'desc' =>  _('Enter a youtube, vimeo or similar URLs. Supports services listed at <a href="http://codex.wordpress.org/Embeds">http://codex.wordpress.org/Embeds</a>.'),
                'id' => $prefix . 'project_video',
                'type' => 'oembed',
            ),
            array(
                'name' =>  _('Project URL'),
                'id'   => $prefix . 'project_url',
                'type' => 'text',
            ),
            array(
                'name' =>  _('Project description'),
                'id'   => $prefix . 'project_description',
                'type' => 'text',
            ),
            array(
                'name' =>  _('Project date'),
                'id'   => $prefix . 'project_date',
                'type' => 'date',
            ),
            array(
                'name' =>  _('Project author'),
                'id'   => $prefix . 'project_author',
                'type' => 'text',
            )

        ),
    );



/********************* META BOX REGISTERING ***********************/

/**
 * Register meta boxes
 *
 * @return void
 */
function orion2_register_meta_boxes()
{
	// Make sure there's no errors when the plugin is deactivated or during upgrade
	if ( !class_exists( 'RW_Meta_Box' ) )
		return;

	global $meta_boxes;
	foreach ( $meta_boxes as $meta_box )
	{
		new RW_Meta_Box( $meta_box );
	}
}
// Hook to 'admin_init' to make sure the meta box class is loaded before
// (in case using the meta box class in another plugin)
// This is also helpful for some conditionals like checking page template, categories, etc.
add_action( 'admin_init', 'orion2_register_meta_boxes' );
